#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    string line;
    while (getline(cin, line)) {
        transform(line.begin(), line.end(), line.begin(), [](char ch) {
            if (ch == '.')return ' ';
            else return ch;
        });
        istringstream iss(line);
        vector<int> ip;
        for (int num; iss >> num;)ip.push_back(num);
        if (ip.size() != 4) {
            cout << 'N' << endl;
            continue;
        }

        if (ip[0] > 255 || ip[0] < 0) {
            cout << 'N' << endl;
            continue;
        }
        if (ip[1] > 255 || ip[1] < 0) {
            cout << 'N' << endl;
            continue;
        }
        if (ip[2] > 255 || ip[2] < 0) {
            cout << 'N' << endl;
            continue;
        }
        if (ip[3] > 255 || ip[3] < 0) {
            cout << 'N' << endl;
            continue;
        }
        cout << 'Y' << endl;
    }

    return 0;
}